
/**********************************************************************
***********************************************************************
* FILE		: PowerControl.h
* Description	: 
*			  
* Copyright (c) 2013 by BTCS. All Rights Reserved.
* 
* History:
* Version		Name       		Date			Description
   0.1		AlexZhang	2013/01/02	Initial Version
   
***********************************************************************
**********************************************************************/


#ifndef _POWERCONTROL_H_
#define _POWERCONTROL_H_


typedef struct{
	unsigned char cmd;
	unsigned char data1;
	unsigned char data2;
	unsigned char data3;
	unsigned char data4;
}IBUS_DATA;


#define DAC_EN_CONFIG TRISCbits.TRISC0 = 0
#define pRST_CONFIG TRISEbits.TRISE2 = 0
#define pRD_CONFIG TRISEbits.TRISE3 = 0
#define pWR_CONFIG TRISEbits.TRISE4 = 0
#define pCS_CONFIG TRISEbits.TRISE5 = 0
#define pBUS_CLK_CONFIG TRISHbits.TRISH0 = 0

#define DAC_EN PORTCbits.RC0
#define pRST PORTEbits.RE2
#define pRD PORTEbits.RE3  
#define pWR PORTEbits.RE4  
#define pCS PORTEbits.RE5
#define pBUS_CLK	 PORTHbits.RH0

void IbusWrite(IBUS_DATA * ibus_info);
void IbusInit(void);


#endif /*_POWERCONTROL_H_*/

